<?php
/**
 * Created by PhpStorm.
 * User: yafex
 * Date: 2020/12/1
 * Time: 8:56
 */
class serv_noLogin_report extends L {

    /**
     * 描述 : 订单数量统计
     * 作者 : Zoro.Zhu
     */
    public function orderQty(){
        $uay = [
            'zorozhu' => '张琴',
            'zqin' => '张琴',
            'xiaolin' => '肖琳',
            'xiaoxinhui' => '肖鑫晖',
            'xiaoxinhui2020' => '肖鑫晖',
            'zoro_zhu' => '朱银鸿',
            'zoro_zhu2' => '朱银鸿',
            'zoro_zhu3' => '朱银鸿',
            'zoro_zhu4' => '朱银鸿',
            'zhuxj421343925' => '朱贤娟',
            'zhangqian' => '张谦',
        ];
        $date = date('Y-m-d', time() - 86400 * 6);
        $order = "SELECT
            dxmAccount,
            substring( pullTime, 1, 10 ) as time,
            count( 0 ) as qty
        FROM
            `dxm_order` 
        WHERE
            pullTime >= '{$date}' 
        GROUP BY
            dxmAccount,
            substring( pullTime, 1, 10 )
        order by time desc ,qty desc";
        $order = L::sql($order);
        echo '<style> div{font-family:"楷体","楷体_GB2312";} 
            .bai{
    background-color: #ffffff;
    padding-top:33px;
    overflow: hidden;
  }
  .baibai{
    position: relative;
    width:400px;
    margin:20px auto;
    color: #FF0000;
    line-height: 1;
    font-size: 52px;
    text-align: center;
    overflow: hidden;
    font-family: "楷体","楷体_GB2312";
  }
.baibai:after{
    width: 300%;
    height: 100%;
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    background: -webkit-gradient(linear, left top, right top, color-stop(0, rgba(245,255,41, 0.4)), color-stop(0.4, rgba(245,255,66, 0.5)), color-stop(0.5, rgba(245,255,9, 0.1)), color-stop(0.6, rgba(245,255,9, 0.7)), color-stop(1, rgba(245,255,9, 0.2)));
    -webkit-animation: slide ease-in-out 2s infinite; 
}
@-webkit-keyframes slide{
    0%{-webkit-transform:translateX(-66.666%);}
    100%{-webkit-transform:translateX(0);}
        </style>';
        echo '<div class="bai" style="text-align: center;font-size: 42px;padding-top: 33px;padding-bottom: 20px;font-weight:900"><div class="baibai">订单数量统计表</div></div>';
        echo '<div style="text-align: center;"><table border="2" style="font-size: 35px;margin: auto;width: 60%"><tr bgcolor="#F9F900"><td style="text-align: center;font-size: 38px;color: #FF0000;font-weight:900">店小秘账号</td><td style="text-align: center;font-size: 38px;color: #FF0000;font-weight:900">时间</td><td style="text-align: center;font-size: 38px;color: #FF0000;font-weight:900">数量</td></tr>';
        $data = [];
        foreach ($order as $acc) {
            if(!empty($uay[$acc['dxmAccount']])){
                if(empty($data[$acc['time']][$uay[$acc['dxmAccount']]])){
                    $data[$acc['time']][$uay[$acc['dxmAccount']]] = $acc['qty'];
                }else{
                    $data[$acc['time']][$uay[$acc['dxmAccount']]] += $acc['qty'];
                }
            }
        }
        $color = [
            '#FF0000',//赤
            '#FF8F59',//橙
            '#FFFF37',//黄
            '#79FF79',//绿
            '#80FFFF',//青
            '#46A3FF',//蓝
            '#B15BFF',//紫
        ];
        $i = 0;
        foreach ($data as $time => $acc) {
            foreach($acc as $a => $qty){
                echo "<tr bgcolor='{$color[$i]}'><td style=\"text-align: center;font-size: 35px\">{$a}</td><td style=\"text-align: center;font-size: 35px\">{$time}</td><td style=\"text-align: center;font-size: 35px\">{$qty}</td></tr>";
            }
            $i ++;
        }
        echo '</table></div>';
    }

}
return true;